<extend name="common/base" />

<block name="body">
	<!-- 数据列表 -->
    <table class="table table-bordered datatable"
           data-toggle="datatable"
           data-options="{
        id:'id',
        width:'100%',
        height:'100%',
        showLinenumber:true,
        paging:true,
    }">
        <thead>
            <tr>
                <th>名称</th>
                <th>标识</th>
                <th >描述</th>
                <th width="63px">状态</th>
                <th>作者</th>
                <th width="63px">版本</th>
                <th width="94px">操作</th>
            </tr>
        </thead>
        <tbody>
            <volist name="_list" id="vo">
            <tr>
                <td>{$vo.title}</td>
                <td>{$vo.name}</td>
                <td>{$vo.description}</td>
                <td>{$vo.status_text|default="未安装"}</td>
                <td><a target="_blank" href="{$vo.url|default='http://www.haolie.net'}">{$vo.author}</a></td>
                <td>{$vo.version}</td>
                <td>
                    <empty name="vo.uninstall">
                        <?php
                            $class	= get_addon_class($vo['name']);
                            if(!class_exists($class)){
                                $has_config = 0;
                            }else{
                                $addon = new $class();
                                $has_config = count($addon->getConfig());
                            }
                        ?>
                        <?php if ($has_config): ?>
                            <a href="{:url('config',array('id'=>$vo['id']))}" data-toggle="dialog" data-options="{mask:true}">设置</a>
                        <?php endif ?>
                    <?php if ($vo['status'] >=0): ?>
                        <eq name="vo.status" value="0">
                            <a data-toggle="doajax" href="{:url('enable',array('id'=>$vo['id']))}">启用</a>
                        <else />
                            <a data-toggle="doajax" href="{:url('disable',array('id'=>$vo['id']))}">禁用</a>
                        </eq>
                    <?php endif ?>
                        {// <eq name="vo.author" value="thinkphp">}
                            <a data-toggle="doajax" href="{:url('uninstall?id='.$vo['id'])}">卸载</a>
                        {// </eq>}
                    <else />
                        <a data-toggle="doajax" href="{:url('install?addon_name='.$vo['name'])}">安装</a>
                    </empty>
                </td>
            </tr>
            </volist>
        </tbody>
        <tfoot>
            <tr>
                <th colspan="6">{$_page}</th>
            </tr>
        </tfoot>
    </table>
</block>

<block name="script">
    <script>
        function goToPage(page) {
            var url = '{:url("index")}';
            url += (url.indexOf('?')!==false)?'&':'?';
            url += $.zui.pageInfo.pageVar+'='+page;
            currenttab().loadUrl(url);
        }
    </script>
</block>